package com.ctvit.sjk.knowledge.resource.pojo.vo;

import com.alibaba.fastjson2.JSONObject;
import com.ctvit.sjk.knowledge.dataset.pojo.domain.TabDataset;
import com.ctvit.sjk.knowledge.resource.pojo.domain.TabFunctionLib;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.time.LocalDateTime;

/**
 * 函数库VO
 *
 * @author heyingcheng
 * @date 2025/3/27
 */
@Getter
@Setter
@ToString
public class FunctionLibGetVO {

    private String id;

    private String name;

    private String desc;

    private String code;

    @JsonProperty("input_field_list")
    private JSONObject inputFieldList;

    @JsonProperty("permission_type")
    private String permissionType;

    @JsonProperty("is_active")
    private Boolean isActive;

    @JsonProperty("user_id")
    private String userId;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    public FunctionLibGetVO(TabFunctionLib entity) {
        this.id = entity.getFunctionLibId();
        this.name = entity.getFunctionLibName();
        this.desc = entity.getFunctionLibDesc();
        this.code = entity.getFunctionLibCode();
        this.inputFieldList = JSONObject.parseObject(entity.getInputFieldList());
        this.permissionType = entity.getPermissionType();
        this.isActive = entity.getActiveFlag();
        this.userId = entity.getCreateId();
        this.createTime = entity.getCreateTime();
        this.updateTime = entity.getUpdateTime();
    }

}
